package com.huawei;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "MyServlet",urlPatterns="/Servlet01")
public class MyServlet extends HttpServlet{
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("hello");

        PrintWriter writer =  response.getWriter();
        writer.println("111111");

        String name = request.getParameter("username");
        String password=  request.getParameter("password");

        System.out.println(name);
        System.out.println(password);

        if(("lcy").equals(name)){
            if(("123").equals(password)){
                System.out.println("成功");
            }else System.out.println("登录失败");
        }else System.out.println("登录失败");
    }
}
